package com.ccc.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * Stock entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "stock")
public class Stock {


	private Integer stockId;
	private Product product;
	private User user;
	private Integer stockCount;
	private Integer currentTime;


	public Stock() {
	}
	
	public Stock(Integer stockId) {
		super();
		this.stockId = stockId;
	}

	public Stock(Product product, User user, Integer stockCount,
			Integer currentTime) {
		this.product = product;
		this.user = user;
		this.stockCount = stockCount;
		this.currentTime = currentTime;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "stockId", unique = true, nullable = false)
	public Integer getStockId() {
		return this.stockId;
	}

	public void setStockId(Integer stockId) {
		this.stockId = stockId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "productId", nullable = false)
	public Product getProduct() {
		return this.product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "userId", nullable = false)
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Column(name = "stockCount", nullable = false)
	public Integer getStockCount() {
		return this.stockCount;
	}

	public void setStockCount(Integer stockCount) {
		this.stockCount = stockCount;
	}

	@Column(name = "currentTime", nullable = false)
	public Integer getCurrentTime() {
		return this.currentTime;
	}

	public void setCurrentTime(Integer currentTime) {
		this.currentTime = currentTime;
	}

}